//
//  BackupsSwitchView.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/27.
//

import SwiftUI

//版本更新
struct VersionTipsDIalogView: View {
    let text :String
    let btn :String
    let dismiss: () -> Void
    
    var body: some View {
        PopupBottomView(title: "版本更新") {
            VStack(spacing: 20) {
                Text(text)
                    .font(.system(size: 16))
                    .foregroundStyle(.bgNormalText2)
                    .multilineTextAlignment(.leading) // 设置文本对齐方式
                    .fixedSize(horizontal: false, vertical: true) // 允许垂直方向自适应大小
                    .frame(maxWidth: .infinity, alignment: .topLeading)
                Text(btn.isEmpty ? "我知道了" : btn)
                    .frame(maxWidth: .infinity, maxHeight: 48)
                    .foregroundColor(themeManager.themeColor)
                    .font(.system(size: 16))
                    .background(themeManager.themeColor.opacity(0.1))
                    .cornerRadius(8)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        dismiss()
                    }
            }.frame(maxWidth: .infinity)
                .padding(.top,20)
                .padding(.bottom,40)
        }
    }
}

//#Preview {
//    VersionTipsDIalogView()
//}
//定义预览提供者
struct VersionTipsDIalogView_Previews: PreviewProvider {
    static var previews: some View {
        //使用预览共享配置
        configurePreviewEnvironment(for: VersionTipsDIalogView(text: "测试", btn: ""){})
    }
}
